package com.bom.boot.easy.entity;

import com.bom.boot.easy.core.comment.Comment;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 公共类
 *
 * @author bom
 */
@Data
@MappedSuperclass
@EntityListeners(value = AuditingEntityListener.class)
public class BaseEntity implements Serializable {

    @CreatedDate
    @Comment("创建时间")
    private LocalDateTime createAt;

    @CreatedBy
    @Comment("创建人id")
    private Long createdBy;

    @LastModifiedDate
    @Comment("修改时间")
    private LocalDateTime modifiedAt;

    @LastModifiedBy
    @Comment("修改人id")
    private Long modifiedBy;

    @Comment("删除状态")
    private Boolean del;

    @Version
    @Comment("版本号")
    private Long version;

}
